package org.larkdoc.service.impl;

import java.util.List;

import org.apache.commons.lang3.StringUtils;
import org.larkdoc.dao.RoleRelPermissionsMapper;
import org.larkdoc.model.entity.RoleRelPermissions;
import org.larkdoc.service.RoleRelPermissionsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * 角色与权限关系业务功能实现类
 * 
 * @author  zhangpeijun[zhangpeijun1024@qq.com]
 * @version  [v1.0.1, 2017年10月17日]
 * @see  [相关类/方法]
 * @since  [产品/模块版本]
 */
@Service("roleRelPermissionsService")
public class RoleRelPermissionsServiceImpl implements RoleRelPermissionsService {
    
    @Autowired
    RoleRelPermissionsMapper roleRelPermissionsMapper;
    
    @Override
    public int deleteByPrimaryKey(Integer id) {
        return roleRelPermissionsMapper.deleteByPrimaryKey(id);
    }
    
    @Override
    public int insert(RoleRelPermissions record) {
        return roleRelPermissionsMapper.insert(record);
    }
    
    @Override
    public int insertSelective(RoleRelPermissions record) {
        return roleRelPermissionsMapper.insertSelective(record);
    }
    
    @Override
    public RoleRelPermissions selectByPrimaryKey(Integer id) {
        return roleRelPermissionsMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public int updateByPrimaryKeySelective(RoleRelPermissions record) {
        return roleRelPermissionsMapper.updateByPrimaryKeySelective(record);
    }
    
    @Override
    public int updateByPrimaryKey(RoleRelPermissions record) {
        return roleRelPermissionsMapper.updateByPrimaryKey(record);
    }
    
    @Override
    public List<RoleRelPermissions> selectByUserAccount(String account) {
        if (StringUtils.isNotBlank(account)){
            return roleRelPermissionsMapper.selectByUserAccount(account);
        } else {
            return null;
        }
    }
    
}
